<template>
  <div class="content">
    <div class="content__left" v-show="isHidden">
      <left-tree ref="leftTreeRef" />
    </div>
    <div class="content__empt" v-show="!isHidden">
      <left-empt />
    </div>
    <div class="content__right">
      <right-view ref="rightViewRef" />
    </div>
  </div>
</template>

<script lang="ts" setup>
import { provide, ref, watch } from "vue";
import LeftTree from "./components/LeftTree.vue";
import LeftEmpt from "./components/LeftEmpt.vue";
import RightView from "./components/RightView.vue";
import { useProjectStoreHook } from "/@/store/modules/project";

let active: any = ref({});
let isHidden = ref<boolean>(true);
// const leftTreeRef = ref<HTMLElement | null>(null) as any;
// const rightViewRef = ref<HTMLElement | null>(null) as any;

const projectHook = useProjectStoreHook();

// 监听右侧数据变化
watch(
  () => projectHook.isHidden,
  newVal => {
    isHidden.value = newVal;
  }
);

provide("active", active);
</script>

<style lang="scss" scoped>
.content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: calc(100vh - 120px);
  width: 100%;
  &__left {
    height: inherit;
    width: 300px;
    margin-right: 5px;
  }
  &__empt {
    height: inherit;
    width: 30px;
    margin-right: 5px;
  }
  &__right {
    height: inherit;
    flex: 1;
    background: #fff;
    overflow-x: auto;
  }
}
</style>
